import createStore from 'ipreact-for-react'
import { UserInfo } from '../../apis';

export interface ContentStore {
    /** 用户信息 */
    loginUser?: UserInfo;
    loading?: boolean;
    mode?: 'default' | 'min';
}

const { dispatch, connect, getState } = createStore<ContentStore>([
    (p, p1) => {
        const container = document.getElementById(__CONFIG__.prefixClass)
        if (container) {
            container.style.width = p1.mode === 'min' ? '2px' : '400px'
        }
    }
])({
    loginUser: null,
    mode: 'default',
})
export { dispatch, connect, getState }